package com.onemore.task.remote;

import java.sql.SQLException;

import org.voovan.http.server.HttpResponse;
import org.voovan.tools.log.Logger;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.onemore.task.OneJdbc;
import com.onemore.task.model.ModelShangpin;
import com.onemore.task.model.ModelSpgg1;
import com.onemore.task.model.ModelSpgg2;

public class TaskTest extends RmtTaskBase{
	public void process(JSONObject jsonObject,HttpResponse response)
	{
		int ret = 0;
		JSONObject testJson = jsonObject;
		for(int i=1;i<11;i++) {
			try {
				if(OneJdbc.insert_test(testJson) ) {
					break;
				}else {
					message = "插入测试失败";
					Logger.error(message);
					if(i == 1) {
						ret = -1;
						break;	    								
					}
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				message = e.getMessage();
				ret = -210;
				//Logger.debug(e);
				Logger.simple("getSQLState:"+e.getSQLState());
				Logger.simple("getMessage:"+e.getMessage());
				Logger.simple("getLocalizedMessage:"+e.getLocalizedMessage());
				break;
			}
		}
        putResult(response, ret, message);
	}
}
